<?php
/**
 * CEOfox
 *
 * @copyright  Copyright 2011-2012 CEOfox, Inc.
 * @license    http://ceofox.com/pages/license
 * @version    $Id: feed.service_feed_get_start.php 87081 2013-05-24 09:40:17 $
 * @author     CEOfox, Inc.
 */
?>
<?php
    if(Phpfox::isModule('follow'))
    {
        Phpfox_Error::skip(true);
        if(PHPFOX_IS_AJAX && $iFeedId == null && !Phpfox::getUserParam('privacy.can_view_all_items'))
        {
                     
            Phpfox::getService('follow')->getFeedFromFollowing($iUserid);
        }
        if ($iUserid == null && !Phpfox::getUserParam('privacy.can_view_all_items') && Phpfox::getLib('module')->getModuleName() == 'core')
        {           
            Phpfox::getService('follow')->getFeedFromFollowing(Phpfox::getUserId());
        }
        if (defined('PHPFOX_IS_USER_PROFILE') && $iFeedId == null && Phpfox::getlib('module')->getModuleName() == 'profile')
        {     
            if($iUserid != Phpfox::getUserId())
            {
                $bCanViewOtherFeed = Phpfox::getLib('database')->select('up.user_value')
                        ->from(Phpfox::getT('user_privacy'),'up')
                        ->where('up.user_privacy = "follow.view_following_feed_profile" AND up.user_id = '.(int)$iUserid)
                        ->execute('getSlaveField');
                if((int)$bCanViewOtherFeed == 4 && $bCanViewOtherFeed)
                {
                    return false;
                }
            }
            Phpfox::getService('follow')->getFeedFromFollowing($iUserid);
        }
        if(defined('PHPFOX_IS_USER_PROFILE') && Phpfox::getLib('module')->getModuleName() == 'follow')
        {
            Phpfox::getService('follow')->getFeedFromFollowing(Phpfox::getUserId());
        }
        Phpfox_Error::skip(false);
    }
?>
